package com.ashapo.pattern.pattern005prototype;

//第4步
//PrototypePatternDemo使用ShapeCache类来获取存储在Hashtable中的形状（shape）的克隆。

public class PrototypePatternDemo {

    /**
     * 原型模式
     * @param args
     */
    public static void main(String[] args) {
        ShapeCache.loadCache();

        Shape clonedShape = (Shape) ShapeCache.getShape("1");
        System.out.println("Shape : " + clonedShape.getType());

        Shape clonedShape2 = (Shape) ShapeCache.getShape("2");
        System.out.println("Shape : " + clonedShape2.getType());

        Shape clonedShape3 = (Shape) ShapeCache.getShape("3");
        System.out.println("Shape : " + clonedShape3.getType());
    }
}
